<?php get_header();?>
<?php get_template_part('left','menu');?>
<section> 
    <!--s container-->
<div class="container">
	<div class="wrap" >
        <div style="height:5px"></div>
            <div class="mallClass" style=" padding-top:10px; padding-bottom:10px;border:1px dashed #cccccc;"  >
        <span >商家：</span>
        <a href="<?php bloginfo('url'); ?>/details"  class="current" >全部</a>
        
            <?php
            /*$args = array(
                'taxonomy'=>'shop',
                'style'=>'none'
            );
            wp_list_categories( $args );*/
            $tag_args = array(
                'smallest'=>10,
                'largest'=>10,
                'orderby'=>'count',
                'taxonomy'=>'shop'
            );
            wp_tag_cloud($tag_args);
            ?>
          
        </div>
            <div class="masonryWrap" >
                <?php if( have_posts() ) : $counter = 0; while( have_posts() ) : the_post(); $counter++; ?>
                    <div class="masonryBrick" style="margin:5px">
                        <div class="blBox">
                            <div class="blPic" id="blPic_<?php echo $post->ID;?>">
                            <a href="<?php echo home_url('/');?>go/<?php echo $post->ID?>" rel="nofollow" class="border_radius_3" target="_blank">
                            <?php
                            if( has_post_thumbnail() ){
                                echo get_the_post_thumbnail( $post->ID, array(190, 190), array('alt'=>$post->post_title) );
                            }else{
                                echo '<img src="'.get_post_img( '', 190, 190 ).'" alt="'.$post->post_title .'" width="190" height="190"/>';
                            }
                            ?>
                            </a>
                            <div class="blStore">
                            <?php $terms = get_the_terms( $post->ID, 'shop' );
                        if ( $terms && ! is_wp_error( $terms ) ) : 
                            $draught_links = array();
                            foreach ( $terms as $term ) {
                                $draught_links[] = $term->name;
                                }
                            $on_draught = join( ", ", $draught_links );
                            echo $on_draught;
                        endif; ?>
                            </div>
                            </div>
                            <a class="mB10 blTitle" href="<?php the_permalink();?>" target="_blank"><?php the_title();?><span class="red">&nbsp;&nbsp;&nbsp;<?php echo get_post_meta($post->ID,'_red_title',true);?></span></a>
                            <div class="blInfo mB10">
                            <strong><?php if(get_post_meta($post->ID,'_post_author',true)){ echo get_post_meta($post->ID,'_post_author',true); }else{ the_author();} ?>：</strong><?php echo mb_substr($post->post_title,0,50,'UTF-8');?><div class="blTime"><?php the_time('m-d');?></div>
                            </div>	
                            <div class="blBot">
                                <div class="blLike">
   
                                <?php	
                            if( $user_ID != '' && $user_ID > 0 ) { 
                            $results = $wpdb->get_results("SELECT post FROM wp_userpost_fav WHERE user = $user_ID");
                            $user_faves_arr=array();
                            foreach($results as $result)
                            {                                  
                                array_push($user_faves_arr,$result->post);
                            }	
                            if( !in_array( $post->ID, $user_faves_arr ) ) {
                                    ?>     						
                                        <span class="add_fav"><a href="javascript:void(0);" id="<?php echo the_ID(); ?>" title="收藏本文" class="add_to_fav"><?php echo get_post_fav_count($post->ID); ?>     </a></span> 
                                    
                                        <?php } else { ?>
                                     <span class="add_fav"><a href="javascript:void(0);" id="<?php echo the_ID(); ?>" title="收藏本文" class="add_to_fav"><?php echo get_post_fav_count($post->ID);?> </a></span> 							
                                        <?php } ?> 
                        
                        <?php } else {?>						
                                        <span class="add_fav"><a href="javascript:void(0);" id="<?php echo the_ID(); ?>" title="收藏本文" class="add_to_fav_unlogin"><?php echo get_post_fav_count($post->ID);?> </a></span> 
                               
                        <?php }	?>	
                                
                                
                                
                                <div class="blLikeTip">
                                <div class="blLikeTipInner" id='textcollect_<?php echo the_ID(); ?>'>收藏</div>
                                <div class="blLikeTipBot"></div>
                                
                                </div>
                                
                                
                                </div>
                                <div class="blComment"><?php comments_popup_link( '0', '1', '%'); ?></div>
                                <div class="blzd">
<a href="<?php echo home_url('/');?>go/<?php echo $post->ID?>" rel="nofollow" class="border_radius_3" target="_blank">直达链接</a>
</div>
                                <div class="clear"></div>
                            </div>
                        </div>
                    </div>
                <?php if( $counter == 3 ) : ?>
                    <div id="tagsOne" class="masonryBrick"  style=" margin-left:8px">
                                <div class="findTag">
                                    <div class="findTitleTag">热门标签</div>
                                        <?php
                                        $tag_args = array(
                                            'smallest'=>10,
                                            'largest'=>10,
                                            'orderby'=>'count',
                                            'number'=>20,
                                            'taxonomy'=>'detail_tag'
                                        );
                                        wp_tag_cloud($tag_args);
                                        ?>
                                    <div class="clear"></div>
                                </div>
                            </div>			
                <?php endif; endwhile;endif; ?>
                    </div>	
                    
<div class="pageBox" >
<div class="page"  align="center" >
<?php pagenavi();?></div>
<div class="clear"></div>
</div>
                    


        </div>
		
		
  
	<div class="clear"> </div>
     
</div> 

</section>
<?php get_footer();?>